{include file="header"}
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            {if $item}
            <input type="hidden" name="id" value="{$item.id}">
            {/if}
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>所属公司
                </label>
                <div class="layui-input-block">
                    {if $item}
                    <select name="company_id" lay-verify="required" lay-search="">
                        {volist name="companys" id="val"}
                        <option value="{$val.id}" {if $item.company_id eq $val.id}selected{/if}>{$val.title_cn}</option>
                        {/volist}
                    </select>
                    {else}
                    <select name="company_id" lay-verify="required" lay-search="">
                        {volist name="companys" id="val"}
                        <option value="{$val.id}" >{$val.title_cn}</option>
                        {/volist}
                    </select>
                    {/if}
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red"></span>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>人员名称
                </label>
                <div class="layui-input-block">
                    <input type="text" name="uname" value="{$item?$item.uname:''}" placeholder="" autocomplete="off" class="layui-input" lay-verify="required">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>身份
                </label>
                <div class="layui-input-block">
                    {if $item}
                    <select name="idcard">
                        <option value="1" {if $item.idcard eq 1}selected{/if}>原作者</option>
                        <option value="2" {if $item.idcard eq 2}selected{/if}>制作者</option>
                        <option value="3" {if $item.idcard eq 3}selected{/if}>声优</option>
                    </select>
                    {else}
                    <select name="idcard">
                        <option value="1">原作者</option>
                        <option value="2">制作者</option>
                        <option value="3">声优</option>
                    </select>
                    {/if}
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red"></span>生日
                </label>
                <div class="layui-input-block">
                    <input type="text" id="birthday" name="birthday" value="{$item?$item.birthday:''}" placeholder="" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red"></span>日文汉字
                </label>
                <div class="layui-input-block">
                    <input type="text" name="jp_ch" value="{$item?$item.jp_ch:''}" placeholder="" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red"></span>平假名
                </label>
                <div class="layui-input-block">
                    <input type="text" name="jp_jp" value="{$item?$item.jp_jp:''}" placeholder="" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red"></span>罗马字
                </label>
                <div class="layui-input-block">
                    <input type="text" name="jp_lm" value="{$item?$item.jp_lm:''}" placeholder="" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <button  class="layui-btn" lay-filter="add" lay-submit="">
                    提交
                </button>
            </div>
        </form>
    </div>
</div>
<script>
    layui.use(['form', 'layer','upload','laydate'], function() {
        var upload = layui.upload;
        var form = layui.form,
            layer = layui.layer;
        var laydate = layui.laydate;

        laydate.render({
            elem: '#birthday' //指定元素
            ,type:"date"
        });

        //监听提交
        form.on('submit(add)', function(data) {
            request("POST",'{:url("personnel/post")}',data.field,function (res,msg) {
                //发异步，把数据提交给php
                layer.alert(msg, {icon: 6}, function() {
                    xadmin.close();
                    // 可以对父窗口进行刷新
                    xadmin.father_reload();
                });
            })

            return false;
        });

    })
</script>
{include file="footer"}